<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="/WEB-INF/tag/localeTag.tld" prefix="t"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; UTF-8">
<title>Q & A</title>
<link rel="shortcut icon" href="resources/images/favicon.ico" type="image/x-icon">
<link rel="stylesheet" type="text/css" href="resources/css/bootstrap.css" />
<link rel="stylesheet" type="text/css" href="resources/css/style.css" />
<script type="text/javascript" src="resources/js/jquery-1.11.1.js"></script>
<script type="text/javascript" src="resources/js/bootstrap.js"></script>
<script type="text/javascript" src="resources/js/qanda.js"></script>
<!-- <script type="text/javascript" src="resources/js/feedBackMessage.js"></script> -->
</head>
<body>
	<jsp:include page="parts/header.jsp"></jsp:include>
	<jsp:include page="parts/navigation.jsp"></jsp:include>
	<div class="content">
		<jsp:include page="parts/leftmenu.jsp"></jsp:include>
		<div class="page">
			<div class="btn-group">
				<a class="btn btn-info" href="messages"> <t:locale mName="messages.allMessages" />
				</a> <a class="btn btn-info" href="ureadMessages"> <t:locale mName="messages.unread" />
				</a> <a class="btn btn-info" href="alreadyReadMessages"> <t:locale mName="messages.alreadyRead" />
				</a>
			</div>
			<c:if test="${empty messages}">
				<h2>
					<t:locale mName="messages.noMessages" />
				</h2>
			</c:if>
			<c:if test="${not empty messages}">
				<table class="table table-striped table-condensed text-center" id="container">
					<thead>
						<tr>
							<th class="text-left"><t:locale mName="messages.login" /></th>
							<th class="text-center"><t:locale mName="messages.message" /></th>
							<th class="text-left"><t:locale mName="messages.time" /></th>
							<th class="text-left"></th>
							<th class="text-left"></th>
						</tr>
					</thead>
					<tbody>
						<c:forEach var="m" items="${messages}">
							<tr id="${m.id}">
								<td class="text-left">${m.userLogin}</td>
								<td class="text-center">${m.text}</td>
								<td class="text-left"><fmt:formatDate type="both" dateStyle="short" timeStyle="short" value="${m.time}" /></td>
								<td><span onclick="deleteMessage(${m.id})" class="glyphicon glyphicon-remove"></span></td>
								<c:if test="${m.checked == false }">
									<td id="${m.id}"><span onclick="messageIsRead(${m.id})" class="glyphicon glyphicon-ok-sign"></span></td>
								</c:if>
							</tr>
						</c:forEach>
					</tbody>
				</table>
			</c:if>
		</div>
	</div>
	<jsp:include page="parts/footer.jsp"></jsp:include>
</body>
</html>